﻿using K9Nano.Domain;
using Microsoft.Extensions.Configuration;
using Serilog;

namespace K9Nano.Logging;

public static class LoggingStartupExtensions
{
    public static IK9AppBuilder UseSerilog(this IK9AppBuilder app, IConfiguration configuration)
    {
        app.Services.AddSerilog((sp, lc) => lc
              .ReadFrom.Configuration(configuration)
              .ReadFrom.Services(sp)
              .Enrich.FromLogContext());
        return app;
    }
}
